package com.dmsdbj.itoo.dao;

import com.dmsdbj.itoo.entity.TbUser;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TbUseDao {

    //mapper文件查询测试
    int findUserCount();

    //注解查询实现

    @Insert("insert into tb_user(id,username) VALUES(#{id},#{username})")
    int insertUser(TbUser user);

    @Select("select * from tb_user WHERE username =#{username}")
    @Results({
            @Result(column = "username", property = "username"),
            @Result(column = "password", property = "password")
    })
    List<TbUser> findUserByName(String username);

    @Update("update tb_user SET phone =#{phone} WHERE username =#{username}")
    int updateByUserName(@Param("username") String username,@Param("phone")String c);

    @Delete("delete from tb_user WHERE username =#{username}")
    int deleteByUserName(String username);


}
